<!-- Ndas -->
<div class="main-window-segment" style="padding-top: none; padding-bottom: 20px;">
    <div class="container-fluid">
        <div class="row">
            
            <div class="col-lg-10 col-md-6 col-sm-12">
                <h2>Realisasi <?php echo $this->judul ; ?> </h2>
            </div>
            
            <div class="col-lg-1 col-md-3 col-sm-12" style="padding-top: 20px;">
                
                <?php
			//----------------------------------------------------
			//Development History.Revisi : 0 Kegiatan :1.mencetak hasil filter ke dalam pdf Dibuat oleh : Rifan Abdul Rachman Tanggal dibuat : 18-07-2014  File yang diubah : fund_fail.php  
		
			if (isset($this->lokasi)) {
				$kdlokasi = $this->lokasi;
            }else{
				$kdlokasi ='null';
			}
			if (isset($this->d_akun)) {
				$kdakun = $this->d_akun;
            }else{
				$kdakun ='null';
			}			
			if (isset($this->provinsi)) {
				$kdprovinsi = $this->provinsi;
            }else{
				$kdprovinsi ='null';
			}
			if (isset($this->d_tgl_awal)) {
				$kdtglawal = $this->d_tgl_awal;
            }else{
				$kdtglawal ='null';
			}
			if (isset($this->d_tgl_akhir)) {
				$kdtglakhir = $this->d_tgl_akhir;
            }else{
				$kdtglakhir ='null';
			}
			
			?>
            <div class="btn-group-sm">
                <button type="button" class="btn btn-default dropdown-toggle fullwidth" data-toggle="dropdown" aria-expanded="false"><span class="glyphicon glyphicon-print"></span>&nbsp; Cetak <span class="caret"></span>
                </button>
                      <ul class="dropdown-menu" role="menu">
                        <li><a href="<?php echo URL; ?>PDF/DataRealisasiDanaPerimbangan_BAES1_PDF/<?php echo $kdakun . "/" . $kdlokasi . "/" . $kdprovinsi . "/" . $kdtglawal . "/" . $kdtglakhir; ?>/PDF">PDF</a></li>
                        <li><a href="<?php echo URL; ?>PDF/DataRealisasiDanaPerimbangan_BAES1_PDF/<?php echo $kdakun . "/" . $kdlokasi . "/" . $kdprovinsi . "/" . $kdtglawal . "/" . $kdtglakhir; ?>/XLS">EXCEL</a></li>
                      </ul>
            </div>
            
			<?php

//------------------------------
        ?>
            </div>
            <div class="col-lg-1 col-md-3 col-sm-12" style="padding-top: 20px;">
             
                <button type="button" style="width: 100%" class="btn btn-default" data-toggle="modal" data-target="#modal-app-filter"><span class="glyphicon glyphicon-filter"></span> Filter</button>
              
        
            </div>
        </div>
        
        <div class="row" style="padding-top: 10px">
            
            <div class="col-md-6 col-sm-12">
                <?php
               
				echo Session::get('user');
                ?>
                <br>Tanggal : s.d <?php
                if ((''.Session::get('ta')) == date("Y")) {
				echo (date('d-m-Y'));
				}
				else { echo '31-12-2014';
				}
                ?>
            </div>
            
            <div class="col-md-6 col-sm-12" style="text-align: right;">
                <?php
                    // untuk menampilkan last_update
                    if (isset($this->last_update)) {
                        foreach ($this->last_update as $last_update) {
                            echo "Update Data Terakhir (Waktu Server) :<br> " . $last_update->get_last_update() . " WIB";
                        }
                    }
                ?>
            </div>
            
        </div>
        
    </div>
</div>

<!-- Tabel -->
<div id="table-container" class="wrapper" style="font-size: 85%">
    <table class="footable">
        <!--baris pertama-->
        <thead>
          
				<tr>
                <th rowspan=2 width="10px" class='mid'>No.</th>
                <!--th>KPPN</th-->
                <!--th>Tanggal</th-->
                <!--th rowspan=2 class='mid'>Kode BA</th-->
				 <th rowspan=2 class='mid'> Provinsi </th>
                <th rowspan=2 class='mid' width='150px'> Kode lokasi | Nama Lokasi </th>               
                <th  colspan=12 class='mid'>Bulan</th>
                <th rowspan=2 class='mid'>Total</th>
                </tr>
                <tr>
                    <th id="4"  class='mid' >Jan</th>
                    <th id="5"  class='mid' >Feb</th>
                    <th id="6"  class='mid' >Mar</th>
                    <th id="7"  class='mid' >Apr</th>
                    <th id="8"  class='mid' >Mei</th>
                    <th id="9"  class='mid' >Jun</th>
                    <th id="10"  class='mid' >Jul</th>
                    <th id="11"  class='mid' >Agu</th>
                    <th id="12"  class='mid'>Sep</th>
                    <th id="13"  class='mid'>Okt</th>
					<th id="14"  class='mid'>Nov</th>
					<th id="15"  class='mid'>Des</th>
                </tr>

            </tr>
        </thead>
        <tbody class='ratatengah'>
            <?php
            $no = 1;
            $tot_pot = 0;
			$tot_jan = 0;
			$tot_feb = 0;
			$tot_mar = 0;
			$tot_apr = 0;
			$tot_mei = 0;
			$tot_jun = 0;
			$tot_jul = 0;
			$tot_agt = 0;
			$tot_sep = 0;
			$tot_okt = 0;
			$tot_nov = 0;
			$tot_des = 0;
			$tot_tot = 0;
            if (isset($this->data)) {
                if (empty($this->data)) {
                    echo '<td colspan=12 align="center">Tidak ada data.</td>';
                } else {
                    foreach ($this->data as $value) {
                        echo "<tr>	";
                        echo "<td>" . $no++ . "</td>";
						echo "<td class='ratakiri'>" . $value->get_provinsi() . "</td>";
                        echo "<td class='ratakiri'>" . $value->get_lokasi() . " | " . $value->get_nmlokasi() . "</td>";
						
						//echo "<td class='align-center'><a href=" . URL . "dataDIPA/RevisiDipa/" . $value->get_kdsatker() . "/" . $value->get_rev() . " >" . $value->get_kdsatker() . "</a></td>";
						echo "<td class='ratakanan'>" . number_format($value->get_jan()) . "</a></td>";
						echo "<td class='ratakanan'>" . number_format($value->get_feb()) . "</a></td>";
						echo "<td class='ratakanan'>" . number_format($value->get_mar()) . "</a></td>";
						echo "<td class='ratakanan'>" . number_format($value->get_apr()) . "</a></td>";
						echo "<td class='ratakanan'>" . number_format($value->get_mei()) . "</a></td>";
						echo "<td class='ratakanan'>" . number_format($value->get_jun()) . "</a></td>";
						echo "<td class='ratakanan'>" . number_format($value->get_jul()) . "</a></td>";
						echo "<td class='ratakanan'>" . number_format($value->get_agt()) . "</a></td>";
						echo "<td class='ratakanan'>" . number_format($value->get_sep()) . "</a></td>";
						echo "<td class='ratakanan'>" . number_format($value->get_okt()) . "</a></td>";
						echo "<td class='ratakanan'>" . number_format($value->get_nov()) . "</a></td>";
						echo "<td class='ratakanan'>" . number_format($value->get_des()) . "</a></td>";
						echo "<td class='ratakanan'>" . number_format($value->get_balancing_amt()) . "</a></td>";
                       
                        echo "</tr>	";
                        $tot_jan += $value->get_jan();
						$tot_feb += $value->get_feb();
						$tot_mar += $value->get_mar();
						$tot_apr += $value->get_apr();
						$tot_mei += $value->get_mei();
						$tot_jun += $value->get_jun();
						$tot_jul += $value->get_jul();
						$tot_agt += $value->get_agt();
						$tot_sep += $value->get_sep();
						$tot_okt += $value->get_okt();
						$tot_nov += $value->get_nov();
						$tot_des += $value->get_des();
						$tot_tot += $value->get_balancing_amt();
                    }
					echo "<tr>";
						
					echo "</tr>";
					
                }
            } else {
                
                echo '<td colspan=12 id="filter-first" align="center">Masukkan filter terlebih dahulu.</td>';
                
            }
            ?>
        </tbody>
        <tfoot>
           
			<tr>
                    <td colspan='3'  class='ratatengah'><b>GRAND TOTAL<b></td>
					<td class='ratakanan'><b><?php echo number_format($tot_jan) ?><b></td>
					<td class='ratakanan'><b><?php echo  number_format($tot_feb) ?><b></td>
					<td class='ratakanan'><b><?php echo  number_format($tot_mar) ?><b></td>
					<td class='ratakanan'><b><?php echo  number_format($tot_apr) ?><b></td>
					<td class='ratakanan'><b><?php echo  number_format($tot_mei) ?><b></td>
					<td class='ratakanan'><b><?php echo  number_format($tot_jun) ?><b></td>
					<td class='ratakanan'><b><?php echo  number_format($tot_jul) ?><b></td>
					<td class='ratakanan'><b><?php echo  number_format($tot_agt) ?><b></td>
					<td class='ratakanan'><b><?php echo  number_format($tot_sep) ?><b></td>
					<td class='ratakanan'><b><?php echo  number_format($tot_okt) ?><b></td>
					<td class='ratakanan'><b><?php echo  number_format($tot_nov) ?><b></td>
					<td class='ratakanan'><b><?php echo  number_format($tot_des) ?><b></td>
					<td class='ratakanan'><b><?php echo  number_format($tot_tot) ?><b></td>
            </tr>
        </tfoot>
    </table>
</div>




<div class="modal fade" id="modal-app-filter" tabindex="-1" role="dialog" aria-labelledby="app-filter-label" aria-hidden="true">
        
    <div class="modal-dialog">

        <div class="modal-content">

            <div class="modal-header">

                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Tutup</span></button>
                <h4 class="modal-title" id="app-filter-label"><span class="glyphicon glyphicon-filter"></span> Filter Data</h4>

            </div>
            
            <form id="filter-form" method="POST" action="#" enctype="multipart/form-data">

                <div class="modal-body">
                    
                <!-- Paste Isi Fom mulai nangkene -->
                <div id="wkdkppn" class="alert alert-danger"></div>
                    <label class="isian">Provinsi: </label>
                    <select class="form-control" type="text" name="provinsi" id="provinsi">
					 <option value='' selected>- Semua Provinsi -</option>
                        <!--option value='' selected>- pilih -</option-->
                        <?php
                        foreach ($this->data2 as $value1)
                            echo "<option value = '" . $value1->get_lokasi() . "'>" . $value1->get_lokasi() . " | " . $value1->get_nmlokasi() . "</option>";
                        //if ($kode_kppn==$value1->get_kd_d_kppn()){echo "<option value='".$value1->get_kd_d_kppn()."' selected>".$value1->get_kd_d_kppn()." | ".$value1->get_nama_user()."</option>";} 
                        //else {echo "<option value='".$value1->get_kd_d_kppn()."'>".$value1->get_kd_d_kppn()." | ".$value1->get_nama_user()."</option>";}
                        ?>
                    </select>
                    <br/>
                    <div id="wkdkppn" class="alert alert-danger"></div>
                    <label class="isian">Kode Lokasi: </label>
                    <select class="form-control" type="text" name="kdlokasi" id="kdlokasi">
                        <option value='' selected>- pilih -</option>
<?php
foreach ($this->data4 as $value1)
    echo "<option value = '" . $value1->get_lokasi() . "'>" . $value1->get_lokasi() . " | " . $value1->get_nmlokasi() . "</option>";
?>
                    </select>
                    <br/>


                    <input class="form-control" type="hidden" name="kd_satker" id="kd_satker" value="<?php echo $kode_satker; ?>">
                    <input class="form-control" type="hidden" name="kd_kppn" id="kd_kppn" value="<?php echo $kode_kppn; ?>">
                    <input class="form-control" type="hidden" name="kd_adk_name" id="kd_adk_name" value="<?php echo $_FILES['fupload']['name']; ?>">
                    <input class="form-control" type="hidden" name="kd_jml_pdf" id="kd_jml_pdf" value="<?php echo '10'; ?>">
                    <input class="form-control" type="hidden" name="kd_file_name" id="kd_file_name" value="<?php echo $kode_satker . "_" . $kode_kppn . "_" . date("d-m-y") . "_"; ?>">
                        

                </div>

                <div class="modal-footer">
                    <button type="submit" name="submit_file" class="btn btn-primary" style="width: 100%" onClick="return cek_upload()">Kirim</button>
                </div>

            </form>

        </div>

    </div>

</div>
    

<!-- Skrip -->
    
<script type="text/javascript" charset="utf-8">
    $(function() {
        hideErrorId();
        hideWarning();

    });

    function hideErrorId() {
        $('.alert-danger').fadeOut(0);
    }

    function hideWarning() {
        $('#status').change(function() {
            if (document.getElementById('status').value != '') {
                $('#wstatus').fadeOut(200);
            }
        });

    }

    function cek_upload() {
        var v_status = document.getElementById('status').value;

        var jml = 0;
        if (v_status == '') {
            $('#wstatus').html('Harap pilih');
            $('#wstatus').fadeIn();
            jml++;
        }
        if (jml > 0) {
            return false;
        }
    }
</script>